/*
 * @Description: 生成Mapper
 * @Author: DHL
 * @Date: 2022-01-30 14:20:12
 * @LastEditors: DHL
 * @LastEditTime: 2022-07-20 13:15:50
 */

import { firstToUpperCase, firstToLowerCase } from '../../utils/codeGenUtils'

export function createMapper(codeGenConfig: any) {
  const classNameFirstToUpperCase = firstToUpperCase(codeGenConfig.className)
  const classNameFirstToLowerCase = firstToLowerCase(codeGenConfig.className)
  const className = codeGenConfig.className + 'Mapper'

  return `
package ${codeGenConfig.packageName}.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;

import ${codeGenConfig.packageName}.entity.${classNameFirstToLowerCase}.${classNameFirstToUpperCase};
import ${codeGenConfig.packageName}.entity.${classNameFirstToLowerCase}.dto.Search${classNameFirstToUpperCase}Dto;
import ${codeGenConfig.packageName}.entity.${classNameFirstToLowerCase}.vo.Search${classNameFirstToUpperCase}Vo;
import com.twb.core.base.mapper.TwbBaseMapper;

/**
 * @ClassName: ${className}
 * @Description: ${codeGenConfig.genName}
 * 
 * @author ${codeGenConfig.genAuthor}
 * @date ${codeGenConfig.createData}
 */
  @Mapper
public interface ${className} extends TwbBaseMapper<${classNameFirstToUpperCase}> {
  
  /**
   * @Title: search${classNameFirstToUpperCase}
   * @Description: 列表查询（含查询条件）
   * @param vo
   * @return
   * @author ${codeGenConfig.genAuthor}
   * @date ${codeGenConfig.createData}
   */
  public List<Search${classNameFirstToUpperCase}Dto> search${classNameFirstToUpperCase}(Search${classNameFirstToUpperCase}Vo vo);

  /**
   * @Title: search${classNameFirstToUpperCase}Sum
   * @Description: 列表查询合计（含查询条件）
   * @param vo
   * @return
   * @author ${codeGenConfig.genAuthor}
   * @date ${codeGenConfig.createData}
   */
  public Search${classNameFirstToUpperCase}Dto search${classNameFirstToUpperCase}Sum(Search${classNameFirstToUpperCase}Vo vo);
    
  /**
   * @Title: logicBatchDelete${classNameFirstToUpperCase}ByIds
   * @Description: 批量逻辑删除
   * @param ids
   * @return
   * @author ${codeGenConfig.genAuthor}
   * @date ${codeGenConfig.createData}
   */
  public int logicBatchDelete${classNameFirstToUpperCase}ByIds(List<String> ids);
}
`
}
